<?php

namespace App\Policies;

use App\Models\User;
use Illuminate\Auth\Access\HandlesAuthorization;

class MemberPolicy
{
    public function all(User $user)
    {
        return $user->hasRole('Founder') || $user->hasRole('Daili');
    }

    public function add_daili(User $user)
    {
        return $user->hasRole('Founder');
    }

    public function add(User $user)
    {
        return $user->hasRole('Founder') || $user->hasRole('Daili');
    }

    public function daili(User $user)
    {
        return $user->hasRole('Daili');
    }
    public function update(User $current_user, $user)
    {
        return $current_user->HasRole('Founder') || $current_user->isSuperior($user);
    }

    public function destroy(User $user)
    {
        return $user->hasRole('Founder');
    }

    public function edit_self(User $current_user, $user)
    {
        return $current_user->id === $user->id;
    }
}
